/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "cex_parentesco")
@NamedQueries({
    @NamedQuery(name = "CexParentesco.findAll", query = "SELECT c FROM CexParentesco c")})
public class CexParentesco implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cpa_id")
    private Integer cpaId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 64)
    @Column(name = "cpa_nombre")
    private String cpaNombre;
    @OneToMany(mappedBy = "cexParentesco", fetch = FetchType.LAZY)
    private List<CexHistoriaClinica> cexHistoriaClinicaList;
    @OneToMany(mappedBy = "cexParentesco", fetch = FetchType.LAZY)
    private List<EmeTriaje> emeTriajeList;
    @OneToMany(mappedBy = "cexParentesco", fetch = FetchType.LAZY)
    private List<CexAntecedentesFamiliares> cexAntecedentesFamiliaresList;

    public CexParentesco() {
    }

    public CexParentesco(Integer cpaId) {
        this.cpaId = cpaId;
    }

    public CexParentesco(Integer cpaId, String cpaNombre) {
        this.cpaId = cpaId;
        this.cpaNombre = cpaNombre;
    }

    public Integer getCpaId() {
        return cpaId;
    }

    public void setCpaId(Integer cpaId) {
        this.cpaId = cpaId;
    }

    public String getCpaNombre() {
        return cpaNombre;
    }

    public void setCpaNombre(String cpaNombre) {
        this.cpaNombre = cpaNombre;
    }

    public List<CexHistoriaClinica> getCexHistoriaClinicaList() {
        return cexHistoriaClinicaList;
    }

    public void setCexHistoriaClinicaList(List<CexHistoriaClinica> cexHistoriaClinicaList) {
        this.cexHistoriaClinicaList = cexHistoriaClinicaList;
    }

    public List<EmeTriaje> getEmeTriajeList() {
        return emeTriajeList;
    }

    public void setEmeTriajeList(List<EmeTriaje> emeTriajeList) {
        this.emeTriajeList = emeTriajeList;
    }

    public List<CexAntecedentesFamiliares> getCexAntecedentesFamiliaresList() {
        return cexAntecedentesFamiliaresList;
    }

    public void setCexAntecedentesFamiliaresList(List<CexAntecedentesFamiliares> cexAntecedentesFamiliaresList) {
        this.cexAntecedentesFamiliaresList = cexAntecedentesFamiliaresList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cpaId != null ? cpaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CexParentesco)) {
            return false;
        }
        CexParentesco other = (CexParentesco) object;
        if ((this.cpaId == null && other.cpaId != null) || (this.cpaId != null && !this.cpaId.equals(other.cpaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.CexParentesco[ cpaId=" + cpaId + " ]";
    }
    
}
